package com.netease.financial.common.util;

import android.text.TextUtils;

/**
 * Created by hzwuyufeng on 1/22/16.
 */
public class PhoneNumberUtils {

    public static String getPartHiddenNumber(String phoneNumber) {
        if (TextUtils.isEmpty(phoneNumber)) {
            return null;
        }

        String partHiddenNumber;
        int len = phoneNumber.length();
        if (len >= 8) {
            partHiddenNumber = phoneNumber.substring(0, len - 8) + "****" + phoneNumber.substring(len - 4);
        } else if (len >= 4) {
            partHiddenNumber = "****" + phoneNumber.substring(len - 4);
        } else {
            partHiddenNumber = "****";
        }
        return partHiddenNumber;
    }

}
